home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 5.00 Begin VB.Form frmDiscInfo BorderStyle = 3 'Fixed Dialog Caption = "Disc Info..." ClientHeight = 3345 ClientLeft = 2760 ClientTop = 3750 ClientWidth = 4620 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 3345 ScaleWidth = 4620 ShowInTaskbar = 0 'False StartUpPosition = 1 'CenterOwner Begin VB.Frame fraInfo Caption = "Disc Properties" Height = 2280 Left = 255 TabIndex = 3 Top = 120 Width = 4170 Begin VB.Label lblMediaType Caption = "Media Type:" Height = 240 Left = 330 TabIndex = 16 Top = 315 Width = 1470 End Begin VB.Label lblValueMediaType Caption = "N/A" Height = 240 Left = 2175 TabIndex = 15 Top = 315 Width = 1815 End Begin VB.Label lblValueDiscStatus Caption = "N/A" Height = 240 Left = 2175 TabIndex = 13 Top = 1575 Width = 1815 End Begin VB.Label lblDiscStatus Caption = "Disc Status:" Height = 240 Left = 330 TabIndex = 12 Top = 1575 Width = 1470 End Begin VB.Label lblValueFreeSpaceBlocks Caption = "N/A" Height = 240 Left = 2190 TabIndex = 11 Top = 1890 Width = 1815 End Begin VB.Label lblFreeSpace Caption = "Free Space Blocks:" Height = 240 Left = 330 TabIndex = 10 Top = 1890 Width = 1470 End Begin VB.Label lblValueDiscType Caption = "N/A" Height = 240 Left = 2175 TabIndex = 9 Top = 1260 Width = 1815 End Begin VB.Label lblDiscType Caption = "Disc Type (CD Only):" Height = 240 Left = 330 TabIndex = 8 Top = 1260 Width = 1515 End Begin VB.Label lblValueLastSessionStatus Caption = "N/A" Height = 240 Left = 2175 TabIndex = 7 Top = 945 Width = 1815 End Begin VB.Label lblSessionStatus Caption = "Last Session Status:" Height = 240 Left = 330 TabIndex = 6 Top = 945 Width = 1470 End Begin VB.Label lblValueSessions Caption = "N/A" Height = 240 Left = 2175 TabIndex = 5 Top = 630 Width = 1815 End Begin VB.Label lblSessions Caption = "Number of Sessions:" Height = 240 Left = 330 TabIndex = 4 Top = 630 Width = 1470 End End Begin VB.CommandButton cmdCloseDisc Caption = "Close Disc" Height = 375 Left = 1755 TabIndex = 2 Top = 2820 Width = 1395 End Begin VB.CommandButton cmdCloseSession Caption = "Close Session" Height = 375 Left = 300 TabIndex = 1 Top = 2820 Width = 1395 End Begin VB.CommandButton cmdOK Caption = "OK" Height = 375 Left = 3660 TabIndex = 0 Top = 2820 Width = 780 End Begin VB.Label lblStatus Alignment = 2 'Center BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 285 TabIndex = 14 Top = 2520 Width = 4065 End Attribute VB_Name = "frmDiscInfo" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private WithEvents mobjCDPro As CDWriterPro Attribute mobjCDPro.VB_VarHelpID = -1 Private mblnClosing As Boolean '**************************************************************** '**************************************************************** 'COPYRIGHT 2003 NUMEDIA SOFT, INC. 'This is a sample of how you could use the CDWriterPro control. 'There are improvements which could be made rather easily. 'Feel free to modify it as you see fit. '**************************************************************** '**************************************************************** Private Sub cmdCloseDisc_Click() mblnClosing = True cmdOK.Enabled = False cmdCloseDisc.Enabled = False cmdCloseSession.Enabled = False 'Call close last session method If mobjCDPro.CloseLastSession(True) = False Then MsgBox "Error attempting to Close Disc!", vbCritical, App.Title mblnClosing = False cmdOK.Enabled = True cmdCloseDisc.Enabled = True cmdCloseSession.Enabled = True End If 'Events will tell us if it succeeded or not End Sub Private Sub cmdCloseSession_Click() mblnClosing = True cmdOK.Enabled = False cmdCloseDisc.Enabled = False cmdCloseSession.Enabled = False 'Call close last session method If mobjCDPro.CloseLastSession(False) = False Then MsgBox "Error attempting to Close Session!", vbCritical, App.Title mblnClosing = False cmdOK.Enabled = True cmdCloseDisc.Enabled = True cmdCloseSession.Enabled = True End If 'Events will tell us if it succeeded or not End Sub Private Sub cmdOK_Click() Unload Me End Sub Private Sub Form_Unload(Cancel As Integer) If mblnClosing = True Then Cancel = 1 Exit Sub End If 'Set instance to nothing Set mobjCDPro = Nothing End Sub Public Sub ShowDiscInfo(objCDR As CDWriterPro, frmParent As Form) 'Set local object Set mobjCDPro = objCDR 'Check for media If mobjCDPro.GetMediaType() = mtNotLoaded Then MsgBox "No Media Loaded...Cannot Get Disc Info!", vbOKOnly + vbInformation, App.Title Unload Me Exit Sub End If 'Show Form Me.Show , frmParent 'Get Disc Information SetStatus End Sub Private Sub SetStatus() Dim lngBlocks As Long 'Default these to not enabled cmdCloseDisc.Enabled = False cmdCloseSession.Enabled = False 'Reset this flag mblnClosing = False 'Set number of Sessions lblValueSessions.Caption = mobjCDPro.GetSessionCount() 'Free Space blocks lngBlocks = mobjCDPro.GetDiscFreeSpaceBlocks() lblValueFreeSpaceBlocks.Caption = CStr(lngBlocks) & " Blocks Free" 'Set Media Type label Select Case mobjCDPro.GetMediaType() Case mtCD 'CDR lblValueMediaType.Caption = "CD-R" Case mtCDRW 'CDR/W lblValueMediaType.Caption = "CD-RW" Case mtDVDMR 'DVD-R lblValueMediaType.Caption = "DVD-R" Case mtDVDMRW 'DVD-R/W lblValueMediaType.Caption = "DVD-RW" Case mtDVDPR 'DVD+R lblValueMediaType.Caption = "DVD+R" Case mtDVDPRW 'DVD+RW lblValueMediaType.Caption = "DVD+RW" Case mtDVDRam 'DVD-RAM lblValueMediaType.Caption = "DVD-RAM" Case mtDVDRom 'DVD-ROM lblValueMediaType.Caption = "DVD-ROM" Case mtNotLoaded 'Should never see this lblValueMediaType.Caption = "Not Loaded" End Select 'Set Disc Status label Select Case mobjCDPro.GetDiscStatus() Case dsComplete lblValueDiscStatus.Caption = "Disc is Closed" Case dsEmpty lblValueDiscStatus.Caption = "Empty Disc" Case dsIncomplete lblValueDiscStatus.Caption = "Disc Open" Case dsUnknown lblValueDiscStatus.Caption = "Unknown" End Select 'Set Disc Type label this only applies to CD type media Select Case mobjCDPro.GetDiscType() Case dtCddaCDRom 'Audio or Mode1 CDRom lblValueDiscType.Caption = "CD-DA/CD-ROM" Case dtCDI lblValueDiscType.Caption = "CDI" Case dtCDRomXA lblValueDiscType.Caption = "CD-ROM XA" Case dtUnknown lblValueDiscType.Caption = "Unknown" End Select 'Set Last Session Status Select Case mobjCDPro.GetLastSessionStatus() Case ssEmpty lblValueLastSessionStatus.Caption = "Empty Session" Case ssIncomplete lblValueLastSessionStatus.Caption = "Incomplete Session" 'Let User Close disc/session cmdCloseSession.Enabled = True cmdCloseDisc.Enabled = True Case ssComplete lblValueLastSessionStatus.Caption = "Closed Session" Case ssReserved lblValueLastSessionStatus.Caption = "Unknown" End Select End Sub Private Sub mobjCDPro_ClosingDisc() lblStatus.Caption = "...Closing Disc..." End Sub Private Sub mobjCDPro_ClosingSession() lblStatus.Caption = "...Closing Session..." End Sub Private Sub mobjCDPro_WriteComplete() 'Close is complete lblStatus.Caption = "Closing Successful!!" SetStatus MsgBox "Session/Disc Closed Successful!", vbInformation + vbOKOnly, App.Title mblnClosing = False cmdOK.Enabled = True End Sub Private Sub mobjCDPro_WriteError(ByVal WriteError As CDRPROXLibCtl.eWriteErrorType, ByVal DriveError As CDRPROXLibCtl.eCDError, ByVal sErrorInfo As String, ByVal sSenseInfo As String) Dim strError As String 'Get the error type and strError = "Writing Error: (" & CStr(WriteError) & ") " & sErrorInfo & vbCrLf 'If it is a drive error, add the drive error information 'to the displayed message If WriteError = errDriveError Then strError = strError & GetDriveErrorMessage(DriveError) & vbCrLf & " Error Sense Data: " & sSenseInfo End If 'Display Msg to user MsgBox strError, vbCritical + vbOKOnly mblnClosing = False Unload Me End Sub